Skip to content

Enable pre-commit hooks#1349

Merged
davidharrishmc merged 6 commits intoopenhwgroup:mainfrom
jordancarlin:pre-commit
Apr 9, 2025
Merged

Enable pre-commit hooks#1349
davidharrishmc merged 6 commits intoopenhwgroup:mainfrom
jordancarlin:pre-commit

Conversation

@jordancarlin
Copy link
Member

Add pre-commit hooks to ensure all lint rules pass before committing. This avoids repeatedly pushing to GitHub to try resolving a lint error.

The setup script is updated to automatically enable the pre-commit hooks whenever someone clones the repo and the installation files are updated to install pre-commit when running the main toolchain install.

Migrates the existing ruff lint to run in pre-commit hooks and adds several other basic checks (no large files, no merge conflict indicator marks, parseable yaml/json files, etc.).

There are several other pre-commit hooks that we should enable, but they touch a decent number of files so I'll do them as separate PRs to make it easier to review.

@davidharrishmc
Copy link
Contributor

This scares me a little bit. If you ever graduate and something breaks, I'll never figure out how to fix it.

@rosethompson
Copy link
Contributor

Do we want to try it for a week or two on separate branch and push intentionally malformed test files?
High level I understand how this works, but I am unfamiliar with the detail.

@davidharrishmc davidharrishmc merged commit 26eb88d into openhwgroup:main Apr 9, 2025
3 checks passed
@jordancarlin jordancarlin deleted the pre-commit branch April 30, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants